﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SGRapidForm.Common;
using SGRapidForm.Permission.Entity;
using FishWebLib;

namespace SGRapidForm.Permission.Component
{
  public class HelpCategoryComponent:ComponentBase
    {

      private static string tableName = "sgrf_permission_HelpCategory";

      /// <summary>
      /// 查询所有的帮助类别
      /// </summary>
      /// <returns></returns>

      public List<HelpCategory> HelpCategory_GetCategoryAll()
      {
          return FishBLLHelper.CallSpGetDataItemList<HelpCategory>("sgrf_common_GetAll", null,tableName);
      }
      /// <summary>
      /// 新增帮助类别
      /// </summary>
      /// <param name="dept"></param>
      /// <returns></returns>
      public bool HelpCategory_Add(HelpCategory helpcategory)
      {
          return (FishBLLHelper.CallSpExecuteNonQuery("sgrf_permission_HelpCategory_Add", helpcategory) > 0);
      }

      /// <summary>
      /// 根据Keyid获取一条帮助类别
      /// </summary>
      /// <param name="keyid">帮助类别的Keyid</param>
      /// <returns>帮助类别集合</returns>
      public HelpCategory HelpCategory_GetByKeyid(string keyid)
      {
          return FishBLLHelper.CallSpGetDataItem<HelpCategory>("sgrf_permission_HelpCategory_GetByKeyid", null, keyid);
      }

      /// <summary>
      /// 更新一条帮助类别
      /// </summary>
      /// <param name="UserDetails">一条帮助类别</param>
      /// <returns>是否更新成功</returns>
      public bool HelpCategory_Update(HelpCategory helpcategory)
      {
          return (FishBLLHelper.CallSpExecuteNonQuery("sgrf_permission_HelpCategory_Update", helpcategory) > 0);
      }

      /// <summary>
      /// 查询所有的帮助类别
      /// </summary>
      /// <returns></returns>

      public List<HelpCategory> HelpCategory_GetAll()
      {
          return FishBLLHelper.CallSpGetDataItemList<HelpCategory>("sgrf_permission_HelpCategory_GetAll", null);
      }

      /// <summary>
      /// 删除帮助类别 以及跟类别有相关的页面
      /// </summary>
      /// <param name="keyid">类别keyid</param>
      /// <returns>是否更新成功</returns>
      public bool HelpCategory_Delete(string keyid)
      {
          return (FishBLLHelper.CallSpExecuteNonQuery("sgrf_permission_HelpCategory_Delete", null,keyid) > 0);
      }
          /// <summary>
      ///根据parentkeyid获得帮助类别
      /// </summary>
      /// <returns></returns>

      public List<HelpCategory> HelpCategory_GetByParentKeyid(string parentkeyid)
      {
          return FishBLLHelper.CallSpGetDataItemList<HelpCategory>("sgrf_permission_HelpCategory_GetByParentKeyid", null, parentkeyid);
      }
      
    }
}
